import { http } from '@/utils/request'

// 评价分析相关API
export const evaluationAPI = {
  // 分析单个评价
  analyzeEvaluation(orderRatingId) {
    return http.post('/passeng/evaluation/analyze/', {
      order_rating_id: orderRatingId
    })
  },

  // 批量分析评价
  batchAnalyzeEvaluation(orderRatingIds) {
    return http.post('/passeng/evaluation/batch-analyze/', {
      order_rating_ids: orderRatingIds
    })
  },

  // 获取评价分析列表
  getEvaluationAnalysisList(params = {}) {
    return http.get('/passeng/evaluation/analyze/', params)
  },

  // 获取评价分析仪表板数据
  getEvaluationDashboard(driverId = null, additionalParams = {}) {
    const params = { ...additionalParams }
    if (driverId) {
      params.driver_id = driverId
    }
    return http.get('/passeng/evaluation/dashboard/', params)
  },

  // 获取改进建议
  getImprovementSuggestions(driverId = null, page = 1, pageSize = 20) {
    const params = {
      page: page,
      page_size: pageSize
    }
    if (driverId) {
      params.driver_id = driverId
    }
    return http.get('/passeng/suggestions/', params)
  },

  // 获取培训建议
  getTrainingRecommendations(driverId = null, page = 1, pageSize = 20) {
    const params = {
      page: page,
      page_size: pageSize
    }
    if (driverId) {
      params.driver_id = driverId
    }
    return http.get('/passeng/training/', params)
  },

  // 推送培训建议
  pushTrainingRecommendation(recommendationId) {
    return http.post('/passeng/training/', {
      recommendation_id: recommendationId
    })
  },

  // 更新培训建议状态
  updateTrainingRecommendationStatus(recommendationId, status) {
    return http.put('/passeng/training/', {
      recommendation_id: recommendationId,
      status: status
    })
  },

  // 创建培训建议
  createTrainingRecommendation(data) {
    return http.post('/passeng/training/', data)
  },

  // 更新培训建议
  updateTrainingRecommendation(id, data) {
    return http.put(`/passeng/training/${id}/`, data)
  },

  // 获取司机档案
  getDriverProfile(driverId) {
    return http.get('/passeng/driver/profile/', {
      driver_id: driverId
    })
  },

  // 获取司机改进记忆
  getDriverMemory(driverId, page = 1, pageSize = 20) {
    return http.get('/passeng/driver/memory/', {
      driver_id: driverId,
      page: page,
      page_size: pageSize
    })
  },

  // 创建司机改进记忆
  createDriverMemory(data) {
    return http.post('/passeng/driver/memory/', data)
  }
} 